package guoanmaker.provider.business.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import javax.transaction.Transactional;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import guoanmaker.provider.business.model.ProvideCommodity;
import guoanmaker.provider.business.service.ProvideCommodityServiceInterface;
import guoanmaker.provider.business.service.ProvideCommodityServiceRangeServiceInterface;
import guoanmaker.provider.helper.common.AjaxJson;
import io.swagger.annotations.ApiOperation;

@RestController
public class ProvideCommodityServiceRangeController {

	private final AjaxJson ajaxJson;
	
	@Autowired
    public ProvideCommodityServiceRangeController(ProvideCommodityServiceRangeServiceInterface serviceRangeServiceInterface, AjaxJson ajaxJson) {
        this.serviceRangeServiceInterface = serviceRangeServiceInterface;
        this.ajaxJson = ajaxJson;
    }
	
	@Autowired
	private ProvideCommodityServiceRangeServiceInterface serviceRangeServiceInterface;
	
	 @ApiOperation(value="删除商品所提供的服务地区", notes="删除商品所提供的服务地区")
	 @RequestMapping(value = "/deleteServiceRange", method = RequestMethod.POST)
	 @Transactional
	 public AjaxJson deleteServiceRange(String id){
		boolean resuCode=serviceRangeServiceInterface.deleteCommodityServiceRange(id);
		if(resuCode==true){
			ajaxJson.setSuccess(true).setMsg("操作成功").setStatus(200).setData("删除成功");
		}else{
			ajaxJson.setSuccess(false).setMsg("操作失败").setStatus(250).setData("删除失败");
		}
		return ajaxJson;
	}
	
}
